package com.study.service;

import java.text.SimpleDateFormat;
import java.util.Date;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

@Component
public class DynamicPrintTask implements ScheduledOfTask {

	private Logger logger = LoggerFactory.getLogger(getClass());

	SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

	private int i;

	@Override
	public void execute() {
		logger.info(Thread.currentThread().getName() + "++++++thread id:{},FixedPrintTask execute times:{}"
				+ sdf.format(new Date()), Thread.currentThread().getId(), ++i);
		try {
			//System.out.println("" + (1 / 0));
		} catch (Exception e) {
			e.printStackTrace();
		}

	}

}
